package com.wsd.smartcarwasher.configuration;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.io.File;

@Configuration
public class WebMvcConfiguration extends WebMvcConfigurerAdapter{
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //System.out.println(System.getProperty("user.dir")+ File.separator+"smartwashImages");
        registry.addResourceHandler("/**")
                .addResourceLocations("file:/usr/local/smartwash/uploadFile")
                .addResourceLocations("file:/usr/local/smartwash")
                .addResourceLocations("file:"+System.getProperty("user.dir")+ File.separator+"smartwashImages"+File.separator)
                .addResourceLocations("classpath:/");
        super.addResourceHandlers(registry);
    }
}
